<?php
/**
 * Created by PhpStorm.
 * User: Season
 * Date: 2018/6/13
 * Time: 21:49
 */

require_once  'regexTool.class.php';

$regex = new RegexTool();
if(!$regex->noEmpty($_POST['username']))exit('必须填写用户名');
if(!$regex->is_email($_POST['email']))exit('email格式错误');
if(!$regex->is_mobile($_POST['mobile']))exit('手机格式错误');
if(!$regex->noEmpty($_POST['username']))exit('必须填写用户名');
if(!$regex->noEmpty($_POST['username']))exit('必须填写用户名');

//调试函数
function show_resault($var = null,$isdump = false)
{
    $func = $isdump ? 'var_dump' : 'print_r';
    if (empty($var)) {
        echo 'null';
    } elseif (is_array($var) || is_object($var)) {
        echo '<pre>';
        $func($var);
        echo '</pre>';
    } else {
        $func($var);
    }
    echo '<hr />';
}